home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / dev / gui / gtlayout.lha / Source / LTP_MoveToWindow.c < prev    next >
C/C++ Source or Header  |  1999-01-02  |  798b  |  44 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1999 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. #include "Assert.h"
  15.  
  16. VOID
  17. LTP_MoveToWindow(LayoutHandle *handle)
  18. {
  19.     if(V39)
  20.     {
  21.         WORD left,top,width,height;
  22.  
  23.         LTP_GetDisplayClip(handle->Screen,&left,&top,&width,&height);
  24.  
  25.         if(handle->Window->Width < width)
  26.             left = (width - handle->Window->Width) / 2;
  27.         else
  28.             left = 0;
  29.  
  30.         if(handle->Window->Height < height)
  31.             top = (height - handle->Window->Height) / 2;
  32.         else
  33.             top = 0;
  34.  
  35.         if((left = handle->Window->LeftEdge - left) < 0)
  36.             left = 0;
  37.  
  38.         if((top = handle->Window->TopEdge - top) < 0)
  39.             top = 0;
  40.  
  41.         ScreenPosition(handle->Screen,SPOS_MAKEVISIBLE,left,top,left + width - 1,top + height - 1);
  42.     }
  43. }
  44.